package org.demo.base.log;

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

public class TestJavaLog {
    public static void main(String[] args) throws IOException {

        Logger logger1 = Logger.getLogger(TestJavaLog.class.getName());
        FileHandler fileHandler = new FileHandler("F:\\logs\\test01.log",true);
        fileHandler.setEncoding("utf-8");
        fileHandler.setLevel(Level.ALL);
        fileHandler.setFormatter(new SimpleFormatter());
        logger1.addHandler(fileHandler);
        logger1.log(Level.INFO,"日志输出打印1");
        logger1.log(Level.INFO,"日志输出打印2");
        logger1.log(Level.INFO,"日志输出打印3");
        logger1.log(Level.INFO,"日志输出打印4");
        logger1.log(Level.INFO,"日志输出打印5");
        logger1.log(Level.INFO,"日志输出打印6");

    }
}
